package com.example.demo.es;


import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@AllArgsConstructor
@RestController
@RequestMapping(value = "/test/es/*")
public class EsTestController {


    private final ESBlogRepository esBlogRepository;

    @GetMapping(value = "add")
    public void add(){
        ESBlogEntity entity=new ESBlogEntity();
        entity.setId(1l);
        entity.setTitle("主题");
        esBlogRepository.save(entity);
    }

    @GetMapping(value = "get")
    public Iterable<ESBlogEntity> get(){
        Iterable<ESBlogEntity> repositoryAll= esBlogRepository.findAll();
        return repositoryAll;
    }

}
